if (typeof chrome !== "undefined" && chrome.runtime) {
  chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
    if (request.action === "newAlertContent") {
      chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
        chrome.tabs.sendMessage(tabs[0].id, {
          action: "updateContent",
          content: request.content,
        });
      });
    }
  });
} else {
  console.warn("Chrome runtime environment not detected.");
}
